package mypackage.forfun;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AnalogClock;
import android.widget.Button;
import android.widget.TabHost;

public class tabHostDynamic extends Activity {
	@Override
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.tabdynamic);
		final TabHost tabs = (TabHost) findViewById(R.id.tabhost);
		tabs.setup();
		TabHost.TabSpec spec = tabs.newTabSpec("buttontab");
		spec.setContent(R.id.buttontab);
		spec.setIndicator("Bouton");
		tabs.addTab(spec);
		Button btn = (Button) tabs.getCurrentView()
				.findViewById(R.id.buttontab);
		btn.setOnClickListener(new View.OnClickListener() {
			public void onClick(View view) {
				TabHost.TabSpec spec = tabs.newTabSpec("tag1");
				spec.setContent(new TabHost.TabContentFactory() {
					public View createTabContent(String tag) {
						return (new AnalogClock(tabHostDynamic.this));
					}
				});
				spec.setIndicator("Horloge");
				tabs.addTab(spec);
			}
		});
	}
}